
import React, {Component} from 'react';
import {Platform, StyleSheet, Text, View , Image, ScrollView, TouchableOpacity} from 'react-native';
import {Util} from "./util";
const instructions = Platform.select({
  ios: 'Press Cmd+R to reload,\n' + 'Cmd+D or shake for dev menu',
  android:
    'Double tap R on your keyboard to reload,\n' +
    'Shake or press menu button for dev menu',
});

type Props = {};

export default class setting extends Component<Props> {
  static  navigationOptions={
    headerBackTitle: '设置',
  }
  constructor(props){
    super(props);
    const {navigation} = props;
    this.state= {
      navigation: navigation,
    }
  }
  render() {
    return (
        <ScrollView>
          <View>
            <View style={styles.img_view}>
              <Image style={styles.icon} source={{uri: 'logo'}} resizeMode="contain"/>
              <Text style={styles.version}>
                v1.0.0
              </Text>
            </View>
            <TouchableOpacity style={styles.text_view} navigation={this.state.navigation} onPress={this._goPage.bind(this,'Detail','功能介绍')}>
              <Text style={styles.text}>功能介绍</Text>
            </TouchableOpacity>
            <TouchableOpacity style={styles.text_view} navigation={this.state.navigation} onPress={this._goPage.bind(this,'Help','帮助中心')}>
              <Text style={styles.text} >帮助中心</Text>
            </TouchableOpacity>
            <TouchableOpacity style={styles.text_view} navigation={this.state.navigation} onPress={this._goPage.bind(this,'Tips','服务条款')}>
              <Text style={styles.text}>服务条款</Text>
            </TouchableOpacity>
            <TouchableOpacity style={styles.text_view} navigation={this.state.navigation} onPress={this._goPage.bind(this,'About','关于')}>
              <Text style={[styles.text,styles.bottom_add]}>关于</Text>
            </TouchableOpacity>
          </View>
        </ScrollView>
    );
  }
  _goPage(page,title){
    this.state.navigation.navigate(page,{title: title});
  }

}

const styles = StyleSheet.create({
  img_view:{
    justifyContent: 'center',
    alignItems: 'center',
    marginTop: 40,
  },
  icon:{
    width: 88,
    height: 100,
  },
  text_view: {
    borderTopWidth: Util.pixel,
    borderTopColor: '#ECECEC',
    borderBottomColor: '#ECECEC',
    borderBottomWidth: Util.pixel,
    height: 40,
    paddingLeft: 10,
    justifyContent: 'center',

  },
  text:{
    fontSize: 16,
    color: '#868887',
    fontWeight: '400'
  },
  bottom_add:{
    borderBottomColor: '#ECECEC',
    borderBottomWidth: Util.pixel
  },
  version:{
    fontSize: 13,
    fontWeight: '300',
    marginBottom: 30,

  }
});